|
|
|
|
|
|
|
Listing A.12. Coding the SQLFileOpen routine. |
|
|
|
|
|
|
|
|
Sub SQLFileOpen(strSQLFile As String)
'
' open the SQV script file
'
On Error GoTo SQLFileOpenErr
'
If Len(Trim(strSQLFile)) = 0 Then
SQLVBMain.CommonDialog1.DialogTitle = "Load SQLVB File"
SQLVBMain.CommonDialog1.DefaultExt = "SQV"
SQLVBMain.CommonDialog1.Filter = "SQLVB File|*.SQV"
SQLVBMain.CommonDialog1.ShowOpen
strSQLFile = SQLVBMain.CommonDialog1.filename
End If
'
If Len(Trim(strSQLFile)) = 0 Then
intGlobalErr = True
intSQLFlag = False
GoTo SQLFileOpenExit
End If
'
intSQLFileHandle = FreeFile(0)
Open strSQLFile For Input As intSQLFileHandle
intGlobalErr = False
intSQLFlag = True
GoTo SQLFileOpenExit
'
SQLFileOpenErr:
If Err <> 32755 Then
ErrMsg Err, Error$, intLine, strSQLFile, "SQLFileOpen"
End If
InitApp
intGlobalErr = True
'
SQLFileOpenExit:
'
End Sub |
|
|
|
|
|
|
|
|
Let's skip over the SQLProcess routine and write the SQLFileClose routine next. The only task this routine has to complete is to safely close the script file upon completion. Create a Public Sub procedure called SQLFileClose and enter the code in Listing A.13. |
|
|
|
|
|
|
|
|
Listing A.13. Coding the SQLFileClose routine. |
|
|
|
|
|
|
|
|
Sub SQLFileClose()
'
' close the SQV text file |
|
|
|
|
|